use Koliev&Lebovic.dta

/*

Note
conv=1 if C29
conv=2 if C87
conv=3 if C98
conv=4 if C100
conv=5 if C105
conv=6 if C111
*/


*Table 1 Model 1 (H1 & H3)

oprobit reports auditing punishment monitoring worker0 worker1 prior_reporting participation_length labor_conventions rights_conventions national_power national_capacity democracy i.year, vce(cl ccode) 

*H1
margins, at(auditing=(0 1)) predict(outcome(2)) level(95)
margins, at(auditing=(0 1)) predict(outcome(1)) level(95)
margins, at(auditing=(0 1)) predict(outcome(0)) level(95)

*H3
margins, at(punishment=(0 1)) predict(outcome(2)) level(95)
margins, at(punishment=(0 1)) predict(outcome(1)) level(95)
margins, at(punishment=(0 1)) predict(outcome(0)) level(95)

*for statistical difference in point estimates (use after relevant margins statement)
margins, over(auditing) pwcompare
margins, over(punishment) pwcompare

*For Appendix B, substitute v2x_rule and e_wbgi_gee separately for the measure of national_capacity
*For Appendix C, remove worker1 and worker0 from the model and reestimate as below
*for best records:
*keep if (worker0==0 & worker1==0)
*for worse records:
*keep if worker0==1 | worker1==1

*Table 1 Model 2 (H2 & H4)
*C87_98_29_105=1 for bargaining, organizing, and torture conventions; =0 for nondiscrimination and inequality conventions

oprobit reports ib0.C87_98_29_105##i.auditing ib0.C87_98_29_105##i.punishment ib0.C87_98_29_105##c.monitoring worker0 worker1 prior_reporting participation_length labor_conventions rights_conventions national_power national_capacity democracy i.year, vce(cl ccode) 

*H2
margins C87_98_29_105#auditing, vsquish predict(outcome(2)) level(95)
margins C87_98_29_105#auditing, vsquish predict(outcome(1)) level(95)
margins C87_98_29_105#auditing, vsquish predict(outcome(0)) level(95)

*H4
margins C87_98_29_105#punishment, vsquish predict(outcome(2)) level(95)
margins C87_98_29_105#punishment, vsquish predict(outcome(1)) level(95)
margins C87_98_29_105#punishment, vsquish predict(outcome(0)) level(95)

*for statistical difference in point estimates (use after relevant margins statement)
pwcompare C87_98_29_105#auditing
pwcompare C87_98_29_105#punishment

*For Appendix B, substitute v2x_rule and e_wbgi_gee separately for the measure of national_capacity
*For Appendix C, remove worker1 and worker0 from the model and reestimate as below
*for best records:
*keep if (worker0==0 & worker1==0)
*for worse records:
*keep if worker0==1 | worker1==1

*Table 1 Supplemental Analysis
*convention_type=0 for nondiscrimination and inequality conventions; =1 for forced labor conventions; =2 for bargaining and organizing conventions

oprobit reports ib0.convention_type##i.auditing ib0.convention_type##i.punishment ib0.convention_type##c.monitoring worker0 worker1 prior_reporting participation_length labor_conventions rights_conventions national_power national_capacity democracy i.year, vce(cl ccode) 

margins convention_type#auditing, vsquish predict(outcome(2)) level(95)
margins convention_type#auditing, vsquish predict(outcome(1)) level(95)
margins convention_type#auditing, vsquish predict(outcome(0)) level(95)

margins convention_type#punishment, vsquish predict(outcome(2)) level(95)
margins convention_type#punishment, vsquish predict(outcome(1)) level(95)
margins convention_type#punishment, vsquish predict(outcome(0)) level(95)

*for statistical difference in point estimates (use after relevant margins statement)
pwcompare convention_type#auditing
pwcompare convention_type#punishment

*Figure 1

/*
conv=1 if C29
conv=2 if C87
conv=3 if C98
conv=4 if C100
conv=5 if C105
conv=6 if C111
*/

generate reports0=1 if reports==0
generate reports1=1 if reports==1
generate reports2=1 if reports==2

graph bar (sum) reports0 reports1 reports2, over(conv) over(auditing) asyvars stack

*Appendix A

sort auditing
by auditing:tabulate reports conv, col chi2


*Appendix E
clear
use Koliev&Lebovic.selection_model.dta

probit routine_year worker0 worker1 prior_reportingx participation_length national_power national_capacity democracy i.year, vce(cluster ccode)

predict phat, xb
gen phat2=phat^2
gen mills = exp(-.5*phat2)/(sqrt(2*_pi)*normprob(phat))

keep if routine_year==1

oprobit reports mills auditing punishment monitoring worker0 worker1 prior_reporting participation_length labor_conventions rights_conventions national_power national_capacity democracy i.year, vce(cl ccode) 

oprobit reports mills ib0.C87_98_29_105##i.auditing ib0.C87_98_29_105##i.punishment ib0.C87_98_29_105##c.monitoring worker0 worker1 prior_reporting participation_length labor_conventions rights_conventions national_power national_capacity democracy i.year, vce(cl ccode) 

